<!-- 待收来电 > 仅转发-->
<template>
	<view>
		<van-popup v-model="showCompo" closeable round position="bottom" :style="{ height: '100%' }"
			@click-close-icon="toClose" @click-overlay="toClose">
			<van-row type="flex" justify="center">
				<van-col offset="1" span="8">
					<van-cell value="仅转发" />
				</van-col>
			</van-row>
			<van-form @submit="onSubmit">
				<van-cell-group inset>
					<van-field v-model="formData.title" name="title" label="标题" placeholder="请输入内容" input-align="right"
						:rules="[{ required: true, message: '请填写标题' }]" />

					<van-cell title="呈送领导" :value="formData.csldToName" is-link @click="showCsldSheet" />
					<csld :showCsld="showCsld" :dataList="csldList" @closeCsldSheet="closeCsldSheet"></csld>

					<van-cell title="发往" :value="formData.mainToName" is-link @click="showOrgTreeSheet('mainTo')" />
					<!-- forwardType:mainTO：主办，copyTo：抄送 -->
					<orgTree :showOrgTree="showOrgTreeMain" :nodeData="nodeDataMain" forwardType="mainTo"
						@closeOrgTreeSheet="closeOrgTreeSheet"></orgTree>

					<van-cell title="抄送" :value="formData.copyToName" forwardType="copyTo" is-link
						@click="showOrgTreeSheet('copyTo')" />
					<orgTree :showOrgTree="showOrgTreeCopy" :nodeData="nodeDataCopy" forwardType="copyTo"
						@closeOrgTreeSheet="closeOrgTreeSheet"></orgTree>

					<van-field v-model="formData.otherUnit" name="otherUnit" label="其他单位" placeholder="清输入内容"
						input-align="right" />

					<van-cell required is-link title="等级" :value="formData.emergencyLevelName" @click="showEmergency = true" />
					<van-action-sheet v-model="showEmergency" :actions="emergencySelect" cancel-text="取消"
						@select="onSelectElergency" />

					<van-cell is-link title="重要电报" :value="formData.attentionStatusName"
						@click="showAttention = true" />
					<van-action-sheet v-model="showAttention" :actions="attentionSelect" cancel-text="取消"
						@select="onSelectAttention" />

					<!-- <view class="opinion">
					<text class="opinion-left">处理分类</text>
					<view class="opinion-right">
						<van-checkbox-group v-model="result" direction="horizontal" @change="toggle">
							<van-checkbox  name="0" icon-size="32rpx" shape="square">紧急重要需加急办理</van-checkbox>
						</van-checkbox-group>
					</view>
				</view> -->

					<van-field v-model="sdh" name="sdh" label="发电号" readonly input-align="right" />

					<view class="opinion">
						<text class="opinion-left">预计发号</text>
						<view class="opinion-right">
							<text>{{formData.fdWord}}</text>
							<text>〔{{formData.fdYear}}〕</text>
							<text>{{formData.fdNum}}号</text>
						</view>
					</view>

					<van-field v-model="formData.draftTime" readonly label="拟稿日期" placeholder="点击选择日期"
						@click="showPopFn" input-align="right" />
					<van-popup v-model="showPop" round position="bottom" :style="{ height: '40%' }">
						<van-datetime-picker v-model="currentDate" type="datetime" @change="changeFn()"
							@confirm="confirmFn()" @cancel="cancelFn()" />
					</van-popup>

					<!-- <van-calendar v-model:show="showCalendar" @confirm="onConfirm" /> -->

					<!-- TODO 样式需根据原型调整 -->
					<van-cell>
						<van-row type="flex">
							<van-col span="6" class="box-input">
								<span>份数/页数</span>
							</van-col>
							<van-col span="6" class="box-input">
								共<input class="piban-input" type="digit" v-model="formData.approvePart" />份,
							</van-col>
							<!-- <van-col span="6" class="box-input">
							转发<input class="piban-input" type="digit" v-model="formData.forwardPart"/>份,
						</van-col> -->
							<van-col span="6" class="box-input">
								每份<input class="piban-input" type="digit" v-model="formData.eachPage" />页
							</van-col>
						</van-row>
					</van-cell>


					<van-field v-model="formData.fdDeptName" name="fdDeptName" label="落款单位" input-align="right" />
					<!-- <van-field
					v-model="formData.fdNum"
					name="fdNum"
					label="来电号"
					readonly
					input-align="right"
				  /> -->


					<van-cell title="拟稿人" :value="formData.drafterName"    @click="showDrafterSheet"  is-link/>
					<drafter :showDrafter="showDrafter" :nodeData="nodeDataDrafter" :drafterData="drafterData"
						@closeDrafterSheet="closeDrafterSheet"></drafter>

					<van-field v-model="formData.draftePhone" name="draftePhone" label="电话" input-align="right" />

					<!-- 转发里无此项 -->
					<van-cell title="拟稿单位" :value="formData.drafterDeptName" forwardType="copyTo" is-link
						@click="showOrgTreeSheet('drafterDept')" />
					<orgTree :showOrgTree="showOrgTreeDraftDept" :nodeData="nodeDataForward" forwardType="drafterDept"
						@closeOrgTreeSheet="closeOrgTreeSheet"></orgTree>
					<!-- <van-field
					v-model="formData.drafterDeptName"
					name="drafterDeptName"
					label="拟稿单位"
					input-align="right"
				  /> -->
					<van-field v-model="formData.registerName" name="registerName" label="登记人" readonly
						input-align="right" />
					<van-field v-model="formData.taskNumber" name="taskNumber" label="任务编号" placeholder="任务编号" />
					<van-field v-model="formData.remark" rows="3" autosize label="备注" type="textarea" placeholder=""
						clearable input-align="right" />
					<view class="opinion">
						<text class="opinion-left">发送件</text>
						<view class="opinion-right" v-if="this.util.isNotEmpty(detailBody.all)">
							<text v-for="(item,index) in detailBody.all" class="text-blue" @click="lx.openFile(item, formData.annexId)">{{formData.title}}</text>
						</view>
					</view>
					<view class="opinion">
						<text class="opinion-left">附件</text>
						<view class="opinion-right" v-if="detailAttachment.length>0">
							<text v-for="(item,index) in detailAttachment" class="text-blue" @click="lx.openFile(item, formData.annexId)">{{item.attachName}}</text>
						</view>
					</view>


				</van-cell-group>
				<view style="margin: 40rpx;height: 160rpx;">
					<van-row type="flex" justify="space-around">
						<van-col span="10">
							<van-button type="info" round plain hairline block @click.prevent="toClose">取消</van-button>
						</van-col>
						<van-col span="10">
							<van-button type="info" round block native-type="submit">确定</van-button>
						</van-col>
					</van-row>
				</view>

			</van-form>
		</van-popup>
	</view>
</template>

<script>
	import csld from 'pages/jgj/components/receiveMsgDoc/compo-csld'; //呈送领导选择组件
	import orgTree from 'pages/jgj/components/receiveMsgDoc/compo-orgtree'; //主办组件
	import drafter from 'pages/jgj/components/receiveMsgDoc/compo-drafter';//拟稿人选择
	export default {
		components: {
			csld,
			orgTree,
			drafter
		},
		props: {
			showForward: {
				type: Boolean,
				default: false
			},
		},
		data() {
			return {
				showCsld: false, //呈送领导选择组件
				showCompo: false, //组件是否显示
				showDrafter:false,//拟稿人组件

				csldList: [], //呈送领导list
				csldName: [], //选中的呈送领导，以逗号分割
				csldId: [], //选中的呈送领导id，以逗号分割

				// approveToName:'',//回显的批办人名称，因表单中不存在name字段
				approveName: [], //选中的批办人，以逗号分割
				approveTo: [], //选中的批办人id，以逗号分割

				showOrgTreeMain: false, //主办组件显示
				showOrgTreeCopy: false, //抄送组件显示
				showOrgTreeForward: false, //转发单位显示
				showOrgTreeDraftDept: false, //拟稿单位显示

				//主送显示和隐藏哪些节点
				nodeDataMain: {
					showNode: '', //显示的节点
					hideNode: '', //隐藏的节点
				},
				//抄送
				nodeDataCopy: {
					showNode: '', //显示的节点
					hideNode: '', //隐藏的节点
				},
				//转发单位显示所有单位
				nodeDataForward: {
					showNode: '',
					hideNode: ''
				},
				//拟稿人选择，查询单位所需节点和隐藏节点
				nodeDataDrafter:{
					showNode:'',
					hideNode:''
				},
				//拟稿人信息，串回子组件回显用
				drafterData:{
					userName:'',
					userId:''
				},
				sdh: '(系统生成)',
				formData: {
					"annexId": "",
					"onceAnnexId": "",
					"fdId": "",
					"bizType": "",
					"proInstId": "",
					"officeId": "",
					"formSdStatus": "",
					"completeTime": "",
					"approvePart": "",
					"fdDeptName": "",
					"draftStatus": "",
					"psfsDept": "",
					"approveTo": "",
					"approveToName": "",
					"attentionStatus": "", //重要电报1-是，0-否
					"attentionStatusName": "",
					"remark": "",
					"title": "",
					"mainTo": "",
					"mainToName": "",
					"copyTo": "",
					"copyToName": "",
					"forwardUnit": "",
					"forwardUnitName": "",
					"forwardPart": "",
					"updateId": "",
					"draftePhone": "", //电话
					"eachPage": "",
					"signDept": "",
					"emergencyLevel": "",
					"emergencyLevelName": "",
					"registerId": "",
					"registerName": "", //登记人
					"sdTime": "",
					"approvalId": "",
					"approvalTime": "",
					"parentBizId": "",
					"parentBizType": "",
					"forwardStatus": "",
					"sdWord": "",
					"sdYear": "",
					"sdNum": "",
					"approvalStatus": "",
					"importStatus": "", //处理分类--紧急重要需加急办理
					"fdWord": "",
					"fdYear": "",
					"fdNum": "",
					"leaderType": "",
					// "proInstId": "",
					"otherUnit": "",
					"createTime": "",
					"csldTo": "",
					"csldToName": "",
					"archiveStatus": "",
					"delStatus": "",
					"sdId": "",
					"sendStatus": "",
					"deleterId": "",
					"deleteTime": "",
					"drafterId": "", //拟稿人id
					"drafterName": "", //拟稿人
					"drafterDeptName": "",
					"draftTime": "",
					"drafterDeptId": "",
					"status": "",
					"taskNumber": ''

				},
				detailBody: {}, //正文
				detailAttachment: [], //附件
				//字典相关
				showEmergency: false, //等级
				dictEmergencyLevel: [],
				emergencySelect: [],

				showAttention: false, //重要电报
				attentionSelect: [{
						"name": "否",
						"dictItemCode": 0
					},
					{
						"name": "是",
						"dictItemCode": 1
					}
				],
				showCalendar: false,
				value: '',
				result: [], //处理分类复选框选中的值
				showPop: false,
				currentDate: new Date(),
				changeDate: new Date(),
				configForStart: {}, //提交表单所需参数
				wfmData: {}, //提交返回的参数，调用listNextActivity接口
				endGongWen: [],
				//uuid 和sdId 接口 caac/oa/doc/hbglj/fdpengding/registerType用
				uuid: '', //
				sdId: '',

			}
		},
		mounted() {
			//赋值
			this.initFormData()


			this.getDict() //初始化字典
			this.fdword() //获取发电字头
			this.approveinfo() //获取呈送领导和批办人
          this.cuserdept()
		},
		watch: {
			showForward(val) {
				this.showCompo = val
			},
		},
		methods: {

			//表单数据初始化
			initFormData() {
				this.formData.bizType = 'hbgljsd'
				this.formData.approvePart = '1'
				// this.formData.draftStatus = '2'
				this.formData.attentionStatus = '0' //重要电报：1-是，0-否
				this.formData.attentionStatusName = '否'
				this.formData.forwardPart = '0'
				this.formData.eachPage = '1'
				this.formData.emergencyLevel = 'pj'
				this.formData.emergencyLevelName = '平急'
				this.formData.registerName = this.cache.get("userInfo").userName
				this.formData.registerId = this.cache.get("userInfo").userId
				this.formData.sdTime = this.util.timeFormatYYYYMMDDHHMMSS(new Date())
				this.formData.draftTime = this.util.timeFormatYYYYMMDDHHMMSS(new Date())
				this.formData.sdYear = this.dict.getCurrentYear()
				this.formData.fdYear = this.dict.getCurrentYear()
				// this.formData.approvalStatus='0'
				// this.formData.importStatus='0'
				// this.formData.archiveStatus='2'
				// this.formData.sendStatus='0'
				// this.formData.status='2'
				this.formData.createTime = this.util.timeFormatYYYYMMDDHHMMSS(new Date())
			},
			toggle() {
				if (this.result.length > 0) {
					this.formData.importStatus = 1
				} else {
					this.formData.importStatus = 0
				}
				console.log("this.result: " + JSON.stringify(this.formData.importStatus));
			},
			showPopFn() {
				this.showPop = true
			},
			//等级
			onSelectElergency(item) {
				console.log("item: " + JSON.stringify(item));
				this.formData.emergencyLevel = item.dictItemCode
				this.formData.emergencyLevelName = item.name
				this.showEmergency = false;
			},
			//重要电报
			onSelectAttention(item) {
				this.formData.attentionStatus = item.dictItemCode
				this.formData.attentionStatusName = item.name
				this.showAttention = false
			},
			//显示呈送领导组件
			showCsldSheet() {
				this.showCsld = true
			},
			//关闭呈送领导组件（子组件调用）
			closeCsldSheet(result) {
				console.log("result: " + JSON.stringify(result));
				//result 为子页面传回来的选中的人的数组[{"userId":"10701","userCode":"chenguangcheng_hb","userName":"陈广承","sex":"1","sort":21,"birthday":null,"secretLevel":null,"officePhone":null,"mobilePhone":"13701208132","fax":null,"email":"chenguangcheng_hb@caac.net","zwId":null,"directLeader":null,"idCard":null,"theme":null,"extend1":"002001026","extend2":null,"extend3":null,"extend4":null,"extend5":null,"extend6":"10701","extend7":null,"extend8":null,"extend9":null,"extend10":null,"isValid":"1","createUser":"CAAC_SYSTEM","createTime":"2021-07-27T12:30:00.011+0000","updateUser":"CAAC_SYSTEM","updateTime":"2021-09-02T02:25:00.010+0000"}]

        //重新选择后置空数组，防止重复显示
        this.csldName = []
        this.csldId = []
        if (this.util.isNotEmpty(result)) {
					result.forEach((item) => {
						this.csldName.push(item.userName)
						this.csldId.push(item.userId)
					})
				}
        //赋值回显，以逗号分割
        this.formData.csldToName = this.csldName.toString()
        this.formData.csldTo = this.csldId.toString()
				this.showCsld = false //关闭
			},

			//主办抄送转发单位
			showOrgTreeSheet(type) {
				if (type == 'mainTo') {
					this.showOrgTreeMain = true
				} else if (type == 'copyTo') {
					this.showOrgTreeCopy = true
				} else if (type == 'forward') {
					this.showOrgTreeForward = true
				} else { //type=='drafterDept'
					this.showOrgTreeDraftDept = true
				}


			},
			//拟稿人
			showDrafterSheet(){
				this.showDrafter = true
			},
			/**
			 * 子组件调用，通知父组件关闭当前子组件
			 * @param {Object} orgInfo 选中的数组对象
			 * forwardType   mainTo：主办，copyTo：抄送,forward:转发单位
			 * {forwardType:this.forwardType,orgName:this.deptName.toString(),deptCode:this.deptCode.toString()}
			 */
			closeOrgTreeSheet(orgInfo) {
				if (this.util.isNotEmpty(orgInfo.forwardType)) {
					if (orgInfo.forwardType == 'mainTo') { //主办
            this.formData.mainToName = ''
            this.formData.mainTo = ''
						if (this.util.isNotEmpty(orgInfo.deptCode)) {
							this.formData.mainToName = orgInfo.orgName
							this.formData.mainTo = orgInfo.deptCode
						}
						this.showOrgTreeMain = false
					} else if (orgInfo.forwardType == 'copyTo') { //抄送
            this.formData.copyToName = ''
            this.formData.copyTo = ''
						if (this.util.isNotEmpty(orgInfo.deptCode)) {
							this.formData.copyToName = orgInfo.orgName
							this.formData.copyTo = orgInfo.deptCode
						}
						this.showOrgTreeCopy = false
					} else if (orgInfo.forwardType == 'forward') {
            this.formData.forwardUnitName = ''
            this.formData.orwardUnit = ''
						if (this.util.isNotEmpty(orgInfo.deptCode)) {
							this.formData.forwardUnitName = orgInfo.orgName
							this.formData.forwardUnit = orgInfo.deptCode
						}
						this.showOrgTreeForward = false
					} else { //if(orgInfo.forwardType == 'drafterDept')
						console.log("orgInfo: " + JSON.stringify(orgInfo));
            this.formData.drafterDeptName = ''
            this.formData.drafterDeptId = ''
						if (this.util.isNotEmpty(orgInfo.deptCode)) {
							this.formData.drafterDeptName = orgInfo.orgName
							this.formData.drafterDeptId = orgInfo.deptCode
						}
						this.showOrgTreeDraftDept = false
					}
				}
			},
			//关闭拟稿人组件
			closeDrafterSheet(userInfo){
				//userInfo: {"userId":"4926","userName":"高萌"}
				this.formData.drafterId = userInfo.userId
				this.formData.drafterName = userInfo.userName
				this.showDrafter = false
			},
			// onConfirm(date){
			//   this.value = `${date.getYear()}/${date.getMonth() + 1}/${date.getDate()}`
			//   this.formData.sdTime = date
			//   this.showCalendar = false
			// },
			onSubmit() {
				//校验-请在批办、主办、抄送、局领导、其他单位、转发单位中至少选择一个
				if (this.util.isEmpty(this.formData.csldTo) && this.util.isEmpty(this.formData.approveTo) &&
					this.util.isEmpty(this.formData.mainTo) && this.util.isEmpty(this.formData.copyTo) &&
					this.util.isEmpty(this.formData.otherUnit) && this.util.isEmpty(this.formData.forwardUnit)) {
					this.$toast('请在发往、抄送、其他单位、或程送领导中至少选择一个！')
					return
				} else {
					//提交
					// this.$toast('提交')
					this.save()
					console.log("this.formData: " + JSON.stringify(this.formData));
				}
			},

			//提交,提交成功后调listNextActivity接口，再调completeWorkitem接口
			save() {
				this.formData.proInstId = ''
				// this.tuiGongWen[0].participants='user:'+this.gwSercet.userId
				var _this = this
				this.$httploading({
					url: this.$http.adornUrl(`/caac/oa/doc/hbglj/fd`),
					method: 'post',
					params: {
						'systemKey': this.cache.get('userInfo').systemKey, //固定值
						'systemFlag': this.cache.get('userInfo').systemFlag, //固定值
					},
					data: this.formData,
				}).then(({
					data
				}) => {
					console.log("提交保存结果-->>: " + JSON.stringify(data));
					if (data.code == 200) {
						// this.wfmData = data.data.wfmData//

						// this.listNextActivities()
						// this.sdId = data.data.sdForm.sdId
						this.forwardType()
						// _this.$toast("操作成功")
						uni.redirectTo({
							url: '/pages/jgj/receiveMsg/receive-call'
						})
					} else {
						_this.$toast(data.message + ' code:' + data.code)
					}

				})

			},
			forwardType() {
				var _this = this
				this.$httploading({
					url: this.$http.adornUrl(`/caac/oa/doc/hbglj/fdpengding/forwardType`),
					method: 'post',
					params: {
						'systemKey': this.cache.get('userInfo').systemKey, //固定值
						'systemFlag': this.cache.get('userInfo').systemFlag, //固定值
					},
					data: this.uuid
				}).then(({
					data
				}) => {
					console.log("forwardType data-->>: " + JSON.stringify(data));
					if (data.code == 200) {
						this.$toast("操作成功")
					} else {
						this.$toast(data.message + ' code:' + data.code)
					}

				})
			},
			//获取流转范围
			listNextActivities() {
				var _this = this
				this.$http({
					url: this.$http.adornUrl(`/caac/wfm/ApplicationController/listNextActivities`),
					method: 'post',
					params: {
						//固定值
						'systemKey': this.cache.get('userInfo').systemKey, //固定值
						'systemFlag': this.cache.get('userInfo').systemFlag, //固定值
						'data': this.$http.adornData({
							//this.wfmData:{"workitemId":"2227eaf491764d31b500bde495f3b0df","actDefId":"draft","isClosePage":false,"configId":"d93865b5a11a481087b3a43618574bf1","configCode":"hbgljsdzlc","proDirId":"25b5393051b2419e98092570456dd733","actInstId":"7a9ba2fb85614d3f8455242b993b5abe","httpRemoteIp":"10.6.40.22","message":"保存成功!","proInstId":"af5ab4ac9faa4cc98f157aa854812c41"}
							'wfmData': {
								"workitemId": this.wfmData.workitemId,
								"actDefId": this.wfmData.actDefId,
								"configId": this.wfmData.configId,
								"configCode": this.wfmData.configCode,
								"proDirId": this.wfmData.proDirId,
								"actInstId": this.wfmData.actInstId,
								"proInstId": this.wfmData.proInstId
							}
						})
					}
				}).then(({
					data
				}) => {
					console.log("结束公文参数data===>>>>: " + JSON.stringify(data));
					if (data.code == 200) {
						let nextActDefIds = data.data.nextActDefIds
						// let currentActDefId = data.data.actDefId
						if (this.util.isNotEmpty(nextActDefIds)) {
							for (var i = 0; i < nextActDefIds.length; i++) {
								// if ("csgwmszz" == nextActDefIds[i].actDefId && currentActDefId.indexOf("scsldsp")>-1) {
								// 	_this.tuiGongWen.push(nextActDefIds[i])
								// }else if("sjzbsgzz" == nextActDefIds[i].actDefId && currentActDefId.indexOf("sjldsh")>-1){
								// 	_this.tuiGongWen.push(nextActDefIds[i])
								// }else if("hqjsr" == nextActDefIds[i].actDefId && currentActDefId.indexOf("scsldhq")>-1){
								// 	_this.tuiGongWen.push(nextActDefIds[i])
								// }
								// _this.tuiGongWen.push(nextActDefIds[0])
								// if(nextActDefIds[i].actType == 'end'){
								// 	_this.endGongWen.push(nextActDefIds[i])
								// }
								if (nextActDefIds[i].actDefId == 'fblc' || nextActDefIds[i].actType == 'fblc') {
									nextActDefIds[i].participants = 'user:' + this.cache.get('userInfo').userId
									_this.endGongWen.push(nextActDefIds[i])
									this.completeWorkitem()
								}

							}
						}
					} else {
						_this.$toast(data.message + ' code:' + data.code)
					}

				})
			},
			//结束公文
			completeWorkitem() {
				console.log("endGongWen: " + JSON.stringify(this.endGongWen));
				var _this = this
				this.$httploading({
          url: this.$http.adornUrl(`/caac/wfm/ApplicationController/completeWorkitem`),
					method: 'post',
					params: {
						'systemKey': this.cache.get('userInfo').systemKey, //固定值
						'systemFlag': this.cache.get('userInfo').systemFlag, //固定值
						data: this.$http.adornData({
							sdForm: this.formData, //详情
							wfmData: {
								"workitemId": this.wfmData.workitemId,
								"actDefId": this.wfmData.actDefId,
								"configId": this.wfmData.configId,
								"proDirId": this.wfmData.proDirId,
								"actInstId": this.wfmData.actInstId,
								"proInstId": this.wfmData.proInstId,
								'nextActivities': _this.endGongWen
							},

						})
					}
				}).then(({
					data
				}) => {
					console.log("结束公文data-->>: " + JSON.stringify(data));
					if (data.code == 200) {
						_this.$toast("操作成功")
						uni.redirectTo({
							url: '/pages/jgj/receiveMsg/receive-call'
						})

					} else {
						_this.$toast(data.message + ' code:' + data.code)
					}

				})
			},
			//取消按钮
			toClose() {
				this.$emit('closeForward', '');
			},
			//获取呈送领导和批办人
			approveinfo() {
				var _this = this
				this.$http({
					url: this.$http.adornUrl(`/caac/oa/doc/hbglj/sd/approveinfo`),
					method: 'get',
					params: this.$http.adornParams({
						'systemKey': this.cache.get('userInfo').systemKey, //固定值
						'systemFlag': this.cache.get('userInfo').systemFlag, //固定值
					})
				}).then(({
					data
				}) => {
					//data: {"code":200,"data":{"csld":[],"approve":[]},"message":null}
					console.log("获取呈送领导和批办人-->data: " + JSON.stringify(data));
					if (data.code == 200) {
						if (this.util.isNotEmpty(data.data)) {
							this.csldList = data.data.csld
						} else {
							this.$toast('未获取到人员信息，请联系管理员！')
						}
					}


				})
			},
			//父组件点击登记时调用获取详情回显到表单
			getDetail(fdId, uuid) {
				console.log("fdId: " + fdId + ",uuid:" + uuid);
				this.uuid = uuid
				var _this = this
				this.$httploading({
					url: this.$http.adornUrl(`/caac/oa/doc/sendinfo/listinfo/` + fdId),
					method: 'get',
					params: this.$http.adornParams({
						'systemKey': this.cache.get('userInfo').systemKey, //固定值
						'systemFlag': this.cache.get('userInfo').systemFlag, //固定值
						// 'systemKey': 'ls_liu',//固定值
						// 'systemFlag': 'yidong'//固定值
					})
				}).then(({
					data
				}) => {
					console.log("获取收电详情--data: " + JSON.stringify(data));
					if (data.code == 200) {
						this.getCaacBody(data.data.annexId) //获取发送件
						this.getCaacAttachment(data.data.annexId) //获取附件数据
						this.getConfigForStart() //获取提交表单所需参数
						//给formData赋值，回显
						for (let item in this.formData) {
							for (let item2 in data.data) {
								if (item2 == item) {
									this.formData[item] = data.data[item2]
								}
							}
						}
						this.drafterData.userId = this.formData.drafterId
						this.drafterData.userName = this.formData.drafterName
						console.log("this.formData: " + JSON.stringify(this.formData));
						// this.formData = data.data

					}
				})
			},
			//获取发送件
			getCaacBody(annexId) {
				// fdId = 'c96d8fbcc1f000011ac1cea035606e10'
				var _this = this
				this.$http({
					url: this.$http.adornUrl(`/caac/oa/component/maintext/proInstId/` + annexId),
					method: 'get',
					params: this.$http.adornParams({
						// 'annexId': this.proInstId,
						'systemKey': this.cache.get('userInfo').systemKey, //固定值
						'systemFlag': this.cache.get('userInfo').systemFlag, //固定值
					})
				}).then(({
					data
				}) => {
					if (data.code == 200) {
						this.detailBody = data.data
					}
					console.log("获取发送件: " + JSON.stringify(data));
				})
			},
			//获取附件数据
			getCaacAttachment(annexId) {
				// proInstId = 'c970c796d5300001a2e61ac01170daa0'
				var _this = this
				this.$http({
					url: this.$http.adornUrl(`/caac/oa/component/attachmentupload/attachmentinfoOrderBy`),
					method: 'get',
					params: this.$http.adornParams({
						'bizId': annexId,
						'attachTypeId': 'pageBody_uploadFile',
						'systemKey': this.cache.get('userInfo').systemKey, //固定值
						'systemFlag': this.cache.get('userInfo').systemFlag, //固定值
					})
				}).then(({
					data
				}) => {
					if (data.code == 200) {
						this.detailAttachment = data.data
					}
					console.log("附件: " + JSON.stringify(data));
				})
			},
			//提交表单所需参数
			getConfigForStart() {
				var _this = this
				this.$http({
					url: this.$http.adornUrl(`/caac/wfm/ApplicationController/getConfigForStart`),
					method: 'post',
					params: this.$http.adornParams({
						'configCode': 'hbgljsdzlc', //固定值
						'systemKey': this.cache.get('userInfo').systemKey, //固定值
						'systemFlag': this.cache.get('userInfo').systemFlag, //固定值
					})
				}).then(({
					data
				}) => {
					console.log("签批功能菜单optionBtn01: " + JSON.stringify(data));
					if (data.code == 200) {
						this.configForStart = data.data
					}

				})
			},
			//获取发电头
			fdword() {
				var _this = this
				this.$http({
					url: this.$http.adornUrl(`/caac/oa/doc/hbjgj/fd/fdword`),
					method: 'get',
					params: this.$http.adornParams({
						'systemKey': this.cache.get('userInfo').systemKey, //固定值
						'systemFlag': this.cache.get('userInfo').systemFlag, //固定值
						'type': 'fd', //固定值
						// 'systemFlag': 'yidong'//固定值
					})
				}).then(({
					data
				}) => {
					//{"code":200,"data":{"fdWord":"华北局收眀电","message":"查询成功!"},"message":null}
					console.log("获取发电头--data: " + JSON.stringify(data));
					if (data.code == 200) {
						this.formData.fdWord = data.data.fdWord
						// this.sdwordnum()
					}
				})
			},
			// //获取收电字号
			// sdwordnum(){
			// 	var _this = this
			// 	this.$http({
			// 	  url: this.$http.adornUrl(`/caac/oa/doc/hbglj/fd/sdwordnum`),
			// 	  method: 'get',
			// 	  params: this.$http.adornParams({
			// 		  'systemKey': this.cache.get('userInfo').systemKey,//固定值
			// 		  'systemFlag': this.cache.get('userInfo').systemFlag,//固定值
			// 		  'fdWord': this.formData.fdWord,//固定值
			// 		  'fdYear': this.formData.fdYear
			// 	  })
			// 	}).then(({data}) => {
			// 		//{"code":200,"data":{"sdNum":21,"message":"查询成功!"},"message":null}
			// 		console.log("获取收电字号--data: " + JSON.stringify(data));
			// 		if(data.code==200){
			// 			this.formData.fdNum=data.data.fdNum
			// 		}
			// 	})
			// },
			//获取需要的字典项
			getDict() {
				this.dictSecrecyLevel = this.cache.get('mj') //密级
				//给van-action-sheet 赋值
				this.mj = []
				this.dictSecrecyLevel.forEach((item) => {
					this.mj.push({
						name: item.dictItemName,
						dictItemCode: item.dictItemCode
					})
				})

				this.dictEmergencyLevel = this.cache.get('dbjjcd') //等级
				this.emergencySelect = []
				this.dictEmergencyLevel.forEach((item) => {
					this.emergencySelect.push({
						name: item.dictItemName,
						dictItemCode: item.dictItemCode
					})
				})
			},

			changeFn() { // 值变化是触发
				this.changeDate = this.currentDate // Tue Sep 08 2020 00:00:00 GMT+0800 (中国标准时间)
			},
			confirmFn() { // 确定按钮
				this.formData.draftTime = this.util.timeFormatYYYYMMDDHHMMSS(this.currentDate)
				this.showPop = false
			},
			cancelFn() {
				this.showPop = false;
			},
          //获取当前用户所在的处室信息
          cuserdept(){
            this.$http({
              url: this.$http.adornUrl(`/caac/oa/comm/comm/cuserdept`),
              method: 'get',
              params: this.$http.adornParams({
                'systemKey': this.cache.get('userInfo').systemKey,//固定值
                'systemFlag': this.cache.get('userInfo').systemFlag,//固定值
              })
            }).then(({data}) => {
              if(data.code==200){
                if(this.util.isNotEmpty(data.data)){
                  this.nodeDataMain.showNode = data.data.deptCode
                  this.nodeDataCopy.showNode = data.data.deptCode
                  this.nodeDataForward.showNode = data.data.deptCode
                }
              }
            })
          },

		},
	}
</script>

<style scoped>
	/* 意见相关样式 */
	.opinion {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		margin: 0 32rpx;
		padding: 20rpx 0rpx;
		overflow: hidden;
		font-size: 28rpx;
		line-height: 24px;
		border-bottom: 1px solid #ebedf0;

	}

	.opinion .opinion-left {
		text-align: left;
		color: #323233;
	}

	.opinion .opinion-right {
		text-align: right;
		color: #969799;
	}

	/* 修改复选框文字颜色 */
	/deep/ .van-checkbox__label {
		color: #969799;
	}

	/deep/ .van-field__control--right {
		color: #969799;
	}

	/deep/ .van-cell__title {
		min-width: 10%;
	}

	.box-input {
		display: flex;
		flex-direction: row;

		width: 25%;
	}

	.piban-input {
		display: inline;
		width: 35%;
		height: 100%;
		padding-left: 8rpx;
		border: 1rpx solid #ccc;
	}
</style>
